uniform float maxDist;
uniform float degradation;

varying float dist;

void main(void) {
	gl_FragColor = gl_FrontMaterial.diffuse;
	
	float alpha = 1.0;
	if(dist > maxDist) alpha = 0.0;
	else if(dist > 0.0) alpha = 1.0 - (dist / maxDist);
	alpha = alpha - degradation;
	
	gl_FragColor.a = alpha;
}